package com.visualexpress.dao;

import java.util.List;

import com.visualexpress.domain.Shipment;
import com.visualexpress.domain.User;
import com.visualexpress.domain.UserShipment;

public class test {
	public static void main(String[] args){
		String username = "tsuxia";
		String shipmentNum = "EV000000001CN";
		UserDAO udao = new UserDAO();
		List listUser = (List)udao.findByUsername(username);
		if(listUser.isEmpty()){
			return;
		}
		User user = (User)listUser.get(0);
		
		ShipmentDAO sdao = new ShipmentDAO();
		List listShipment = sdao.findByShipmentNum(shipmentNum);
		if(listShipment.isEmpty()){
			return;
		}
		Shipment shipment = (Shipment)listShipment.get(0);
		UserShipmentDAO usdao = new UserShipmentDAO();
		UserShipment useShipment =(UserShipment)((List)usdao.findByShipmentAndUser(shipment, user)).get(0);
		usdao.delete(useShipment);
		
	}
}
